#include <stdio.h>
#include <stdlib.h>

// open,read
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>

// int main(int argc, char* argv[])
int main()
{
    char buf[1024];
    int fd;
    char test_file[32] = "1_access.c";
    fd = open(test_file, O_RDONLY);
    if (fd < 0)
    {
        perror("打开文件失败");
        exit(0);
    }

    // 读
    int len = 1;
    while (len > 0) {
        len = read(fd, buf, sizeof(buf));
        printf("%s", buf);
    }
    printf("\n");
    close(fd);
    return 0;
}
